//
//  SliderView.m
//  DocumentWatermarking
//
//  Created by apple on 2018/9/17.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "SliderView.h"

@interface SliderView ()

@property(nonatomic,strong)UIView *bgView;//背景视图
@property(nonatomic,strong)UIView *pointView;//拖点
@property(nonatomic,strong)CAShapeLayer *showlayer;

@end

@implementation SliderView


-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self addSubview:self.bgView];
    }
    return self;
}


-(UIView *)bgView{
    
    if (_bgView==nil) {
        _bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 100)];
        _bgView.backgroundColor = [UIColor purpleColor];
        _bgView.layer.masksToBounds = YES;
        _bgView.layer.cornerRadius = 5;
        [_bgView addSubview:self.pointView];
    }
    return _bgView;
}

-(UIView *)pointView{
    if (_pointView==nil) {
        _pointView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 12, 12)];
        _pointView.backgroundColor = [UIColor blueColor];
        UIPanGestureRecognizer *pangess = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(pangess:)];
        [_pointView addGestureRecognizer:pangess];
    }
    return _pointView;
}
/*
 *  手势
 */
-(void)pangess:(UIPanGestureRecognizer*)gess{
    
    _pointView = gess.view;
    CGPoint point = [gess locationInView:_pointView];
    NSLog(@"tuosngde %@",NSStringFromCGPoint(point));
}
@end
